<?php

namespace Summer\Location\Models;

use \Backend\Models\ImportModel;
use Db;

class TownImport extends ImportModel {

    /**
     *  Validation rules
     *  @var array
     */
     public $rules = [];

    public function importData($results, $sessionKey = null) {


        foreach ($results as $row => $data) {

            try {
                $town = new TownModel();
                $town->fill($data);
                $town->save();

                $this->logCreated();

            } catch (\Exception $ex) {
                $this->logError($row, $ex->getMessage());
            }

        }

    }

}
